package com.misoo.ex11;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.view.View;

public class DrawView extends View {
	private Paint pa;
	private Context ctx;
	
	public DrawView(Context context){
		super(context);
		ctx = context;
		pa = new Paint();
	}

	/* (non-Javadoc)
	 * @see android.view.View#onDraw(android.graphics.Canvas)
	 */
	@Override
	protected void onDraw(Canvas canvas) {
		// TODO Auto-generated method stub
		Ex11Activity obj = (Ex11Activity) ctx;
		pa.setColor(obj.getColor());
		canvas.drawRect(10,10,100,100, pa);
		
		pa.setColor(Color.GREEN);
		pa.setStrokeWidth(4);
		pa.setStrokeCap(Paint.Cap.ROUND);
		canvas.drawLine(10, 55, 100, 55, pa);
		canvas.drawLine(55, 10, 55, 100, pa);
		
		pa.setColor(Color.RED);
		canvas.drawRect(50,50,60,60, pa);
		super.onDraw(canvas);
	}
	
	
}
